﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;
using Microsoft.Reporting.WebForms;
namespace VSM
{


    public partial class rptJobcard : System.Web.UI.Page
    {
       StudentRepository sr = new StudentRepository();
            List<StudentClass> sc = new List<StudentClass>();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {

            
            if (!IsPostBack) {
                
                //ReportViewer1.ProcessingMode = ProcessingMode.Local;
                //ReportViewer1.ShowPrintButton = true;
                //ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Business/Service/quota.rdlc");
                //sc = sr.GetStudents();
                //IEnumerable<StudentClass> ie;
                //ie = sc.AsQueryable();
                //ReportDataSource datasource = new ReportDataSource("DataSet1", ie);
                //ReportViewer1.LocalReport.DataSources.Clear();
                //ReportViewer1.LocalReport.DataSources.Add(datasource);


                ReportDocument rptDoc = new ReportDocument();
                CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;

                rptDoc.Load(Server.MapPath("/Business/Service/Jobcard.rpt"));
                CrystalReportViewer1.ReportSource = rptDoc;
                CrystalReportViewer1.HasPrintButton = true;
                //ReportViewer1.ProcessingMode = ProcessingMode.Remote;

                //ServerReport serverReport = ReportViewer1.ServerReport;
                ////serverReport.LoadReportDefinition(Server.MapPath("/Business/Service/Quotation.rpt"));
                //// Set the report server URL and report path
                //serverReport.ReportServerUrl =
                //    new Uri(Server.MapPath("."));
                //serverReport.ReportPath = Server.MapPath("/Business/Service/Quotation.rpt");
                //ItemCategory = Request.QueryString["ItemCategory"] == null ? "" : Request.QueryString["ItemCategory"];
            }
            /*
            if (Session[Utils.AppConstants.ID_User] == null
                || Session[Utils.AppConstants.Password] == null
                || Session[Utils.AppConstants.ID_Dealer] == null)
            {
                Response.Redirect("Login.aspx");
            }
             * */
        }

        protected void btnPrint_Click(object sender, EventArgs e)
        {
            ReportDocument rptDoc = new ReportDocument();
            rptDoc.Load(Server.MapPath("/Business/Service/Jobcard.rpt"));
            rptDoc.PrintToPrinter(1, false, 0, 0);
        }
      
    }
}
